﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace QuanLyKhoHang
{
    public partial class frmThemHang : Form
    {
        public frmThemHang()
        {
            InitializeComponent();
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void btnThem_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand();
            connect k = new connect();
            DateTime d = new DateTime();
            string st;
            d = dtpNgayNhap.Value;
            st = d.ToShortDateString();

            cmd.CommandText = "insert into mathang values('" + txtMaHang.Text + "','" + txtTenHang.Text + "','" + txtDonGia.Text + "','" + txtSoLuong.Text + "','" + st + "','" + txtXuatXu.Text + "','" + txtThongso.Text + "')";
            cmd.Connection = k.getconnect();
            cmd.ExecuteNonQuery();
            this.Close();
        }
    }
}
